function commonAjax(url, data, options, successfn, errorfn) {
    var opts = $.extend({}, defaluts, options);
    data = trimToBlankObj(data);
    $.ajax({
        type: opts.type,
        async: opts.async,
        data: data,
        url: url,
        dataType: opts.dataType,
        success: function(data, textStatus){
            successfn(data);
        },
        error: function(XMLHttpRequest, textStatus, errorThrown){
            errorfn(XMLHttpRequest);
        }
    });

    var defaluts = {
        type: 'GET',
        async: true,
        dataType: 'json'
    };
}

function isBlank(obj){
    if(obj == undefined || obj == null || $.trim(obj) == '')
        return true;
    else
        return false;
}

function trimToEmpty(obj){
    if(isBlank(obj))
        return '';
    else
        return obj;
}

function trimToBlankObj(obj){
    if(isBlank(obj))
        return {};
    else
        return obj;
}

/**
 * 拼接url
 * @param {Object} url
 * @param {Object} data
 * dep:none；
 */
function concatURL(url, data){
    var u = url;
    if(u.indexOf('?') == -1)
        u += '?';
    if(typeof data == 'string')
        u += '&' + decodeURIComponent(data);
    else
        u += '&' + decodeURIComponent($.param(data,true));
    return u;
}

/**
 * 将数据读入form中
 * @param {String} selector 选择器字符串
 * @param {Object} data 数据对象
 * @param {String} prefix 表格input name 前缀
 * dep:easyui
 */
function loadFormData(selector,data,prefix){
    if(!prefix)prefix = '';
    var obj = {};
    for(v in data){
        obj[prefix + v] = data[v];
    }
    $(selector).form('load',obj);
}